//
//  WMSDKSaveTool.h
//  WonderPurchaseSDK
//
//  Created by zero on 2021/7/20.
//

#import <Foundation/Foundation.h>
#import <Security/Security.h>

NS_ASSUME_NONNULL_BEGIN

extern NSString * const PURCHASES_KEY_USER_UUID;
extern NSString * const PURCHASES_KEY_USER_OPENID;
extern NSString * const PURCHASES_KEY_USER_MONEY;

extern NSString * const PURCHASES_KEY_DEVICE_IDFA;
extern NSString * const PURCHASES_KEY_PAY_NotExpend_ID;


@interface WMSDKSaveTool : NSObject


+ (instancetype)sharedTool;


/// 保存信息到 Keychain
/// @param data 信息
/// @param key key
- (void)saveData:(id)data AndKey:(NSString *)key;


/// 从 Keychain 获取信息
/// @param key key
- (id)getDataWithKey:(NSString *)key;


/// 删除 Keychain 对应的信息
/// @param key key
- (void)deleteDataWithKey:(NSString *)key;


/// 保存订单信息到 缓存
/// @param orderInfo 订单信息
- (void)saveOrderInfoToUserDefaultsWithOrderInfo:(NSDictionary *)orderInfo;


/// 从 缓存 中获取订单信息
/// @param orderId 订单id
- (NSDictionary *)getOrderInfoToUserDefaultsWithOrderId:(NSString *)orderId;


/// 从 缓存 中获取订单信息列表
- (NSArray *)getOrderInfoListToUserDefaults;


/// 从 缓存 中删除订单信息
- (void)deleteOrderInfoToUserDefaultsWithOrderInfo:(NSDictionary *)orderInfo;


/// 保存用户余额到 缓存 中
/// @param money 用户余额
- (void)saveUserAllMoneyToUserDefaultsWithMoney:(NSInteger)money;


/// 获取 缓存 中用户的余额
- (NSInteger)getUserAllMoneyToUserDefaults;


/// 保存信息到 缓存 中
/// @param key key
/// @param data 信息
- (void)saveDataToUserDefaultsWithKey:(NSString *)key Data:(id)data;


/// 从缓存中 获取信息
/// @param key key
- (id)getDataToUserDefaultsWithKey:(NSString *)key;


@end

NS_ASSUME_NONNULL_END
